
$(function () {
    $("#submit").click(function (event) {
        event.preventDefault();

        var oldpwdE = $("input[name=oldpwd]");
        var newpwdE = $("input[name=newpwd]");
        var newpwd_repeatE = $("input[name=newpwd_repeat]");

        oldpwd = oldpwdE.val()
        newpwd = newpwdE.val()
        newpwd_repeat = newpwd_repeatE.val()

        zlajax.post({
            "url":"/cms/resetpwd",
            "data":{
                "oldpwd": oldpwd,
                "newpwd": newpwd,
                "newpwd_repeat": newpwd_repeat
            },
            "success":function (data) {
                if (data["code"]==200) {
                    xtalert.alertSuccess("密码修改成功")
                    oldpwdE.val("")
                    newpwdE.val("")
                    newpwd_repeatE.val("")
                }else{
                    var message = data["message"]
                    xtalert.alertError(message)
                    oldpwdE.val("")
                    newpwdE.val("")
                    newpwd_repeatE.val("")
                }

            },
            "fail":function (error) {
                xtalert.alertNetworkError()
                oldpwdE.val("")
                newpwdE.val("")
                newpwd_repeatE.val("")
            }
        })
    })
})